home *** CD-ROM | disk | FTP | other *** search
- on birth me
- return me
- end
-
- on mFindFreeCastRun me, howMany, startIndex
- global gDevelopmentFlag
- if gDevelopmentFlag then
- set castNumberToStartLooking to 400
- else
- set castNumberToStartLooking to startIndex
- end if
- repeat while 1
- tell the stage
- set startEmptyRun to findEmpty(member castNumberToStartLooking of castLib 1)
- end tell
- if howMany = 1 then
- return startEmptyRun
- end if
- set OKRunFlag to 1
- repeat with nextCastMember = startEmptyRun + 1 to startEmptyRun + howMany - 1
- if nextCastMember = 32000 then
- alert("There is not enough free space in your cast to create this auto-animation. Delete any unused castmembers and try again.")
- return 0
- end if
- tell the stage
- set nextEmpty to findEmpty(member nextCastMember of castLib 1)
- end tell
- if nextEmpty <> nextCastMember then
- set castNumberToStartLooking to nextCastMember
- set OKRunFlag to 0
- exit repeat
- end if
- end repeat
- if OKRunFlag then
- return startEmptyRun
- end if
- end repeat
- end
-
- on mModifyRichTextCM me, theText, theFont, theSize
- set theCastName to "RichText" && theFont && theSize
- set theCastNum to the number of member theCastName
- if theCastNum < 1 then
- alert("Internal error: mModifyRichTextCM could not find" && theCastName)
- return 0
- end if
- set the text of member theCastNum to theText
- return theCastNum
- end
-
- on mGetTextWidth me, theCastNum
- set theName to the name of member theCastNum
- set theFontNameAndSize to word 2 of theName & word 3 of theName
- set saveText to the text of member theCastNum
- case theFontNameAndSize of
- "Helvetica24":
- set theMWidth to 20
- "Times24":
- set theMWidth to 22
- "Palatino24":
- set theMWidth to 21
- "Courier24":
- set theMWidth to 23
- "HelveticaBold24":
- set theMWidth to 24
- "TimesBold24":
- set theMWidth to 25
- "PalatinoBold24":
- set theMWidth to 14
- "CourierBold24":
- set theMWidth to 15
- "Arial24":
- set theMWidth to 20
- "TimesNewRoman24":
- set theMWidth to 21
- "CourierNew24":
- set theMWidth to 14
- "ArialBold24":
- set theMWidth to 24
- "TimesNewRomanBold24":
- set theMWidth to 23
- "CourierNewBold24":
- set theMWidth to 15
- otherwise:
- alert("Internal error, mGetTextwidth could find find :" & theFontNameAndSize)
- end case
- set originalHeight to the height of member theCastNum
- set extraMs to 0
- repeat while the height of member theCastNum = originalHeight
- set extraMs to extraMs + 1
- set the text of member theCastNum to the text of member theCastNum & "M"
- end repeat
- set extraMs to extraMs - 1
- set fieldWidth to the width of member theCastNum
- set sizeOfExtraMs to extraMs * theMWidth
- set theRealWidth to fieldWidth - sizeOfExtraMs
- set the text of member theCastNum to saveText
- return theRealWidth
- end
-
- on mGetTextHeight me, theCastNum
- set theRect to the rect of member theCastNum
- set theRectString to string(theRect)
- set theWidthString to item 4 of theRectString
- set theWidth to value(theWidthString)
- return theWidth
- end
-